home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
vxbase1j.lzh
/
VXFORM3.FRM
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1992-12-08
|
26KB
|
605 lines
VXFORM3
Aircraft Brokerage Customers
Form1%
CustStatus
CustExit
E&xit
CustBrowse
&Browse
CustPrevious
&Previous
CustNext
&Next
CustMemo
&Memo
CustDelete
&Delete
CustAdd
CustCancel
&Cancel
CustSave
&Save
G CustRdate
MS Serif
Aircraft
Ai&rcraft
MS Serif
CustDays
MS Serif
F CustCdate
MS Serif
Picture1
CustSeller
Seller
MS Serif
9 CustBuyer
Buyer
MS Serif
BuyRecs
Bu&y Recs
MS Serif
CustFax
MS Serif
D CustPhBus
MS Serif
C CustPhRes
MS Serif
CustZip
MS Serif
CustStateHelp
MS Serif
A CustState
MS Serif
CustCity
MS Serif
CustAddress
MS Serif
CustCompany
MS Serif
CustName
MS Serif
CustCode
MS Serif
Label14
Status
MS Serif
Label13
Revised
MS Serif
Label12
Days on File
MS Serif
Label11
Created
MS Serif
Label10
MS Serif
Label9
Bus Phone
MS Serif
Label8
Res Phone
MS Serif
Label7
MS Serif
Label6
State
MS Serif
Label5
MS Serif
Label4
Address
MS Serif
Label3
Company
MS Serif
Label2
Last Name, First Name
MS Serif
Label1
MS Serif
Form_LoadX
vxSelectDbf
AircustDbf
Form3ActiveG
CustReturn1
BROWSE_ADD6
CustDataClear
CustStatus
Text(
CustSave
Enabled
CustCancel
CustMemoJ
FALSEh
CustAddM
CustDeleteY
BuyRecsU
aircraft
CustCode
BROWSE_EDIT
CustDataLoad
vxTrue
vxRecNo
CustName
CustCompany
CustAddress
CustCity$
CustState
CustZip
CustPhRes>
CustPhBus
CustFax
CustBuyer
Value6
CustSeller1
CustCdateO
CustRdate
CustDaysX
CursorWaitj
EnableCustDatac
vxField
DateCreate
vxDateFormat
xDate
DaysOnFiler
vxDateString
VX_AMERICAN
CustKey
vxUnLock
CursorArrow
DisableCustData&
CustCode_GotFocus
vxCtlLengthL
CustCode_KeyPress
KeyAsciip
CustName_KeyPressy
CustCompany_KeyPress
CustAddress_KeyPress
CustCity_KeyPress
CustZip_KeyPress
CustPhRes_KeyPress
CustPhBus_KeyPress
CustFax_KeyPress
CustState_KeyPress%
CustName_GotFocus=
CustAddress_GotFocusR
CustCity_GotFocush
CustState_GotFocus|
CustZip_GotFocus
CustPhRes_GotFocus
CustPhBus_GotFocus
CustFax_GotFocus>
CustSave_Click
SeekKey
EmptyStringa
vxSeek
AirstateDbf~
vxSelectNtx
Airstat1Ntx*
IsBuyer
IsSellerB
WasBuyer
WasSellerU
RDatec
CDate
vxAppendBlank0
vxReplString
vxReplDate
vxWriteE
RecNumber
vxClose(
BuyerOpen!
Airbuy1Ntx
vxEof
vxDeleteRec
vxSkip
RecNum
AirbuyerDbf
AircraftOpenr
Aircraf1Ntx
StatesOpen
CustStateHelp_Click
SaveReturn9
BROWSE_USER
Airstat2Ntx
StateReturn
VXFORM3
vxBrowse
CustAdd_Click
CustCancel_Click
CustBrowse_Click7
Visible
BrowseCust
CustDelete_Click'
CustExit_Click|
CustNext_Click$
CustNexth
CustPrevious
CustBrowse
vxDeleted
vxBottom
CustPrevious_Click?
vxBof
vxTop
Form_UnloadT
Cancel
vxWindowDereg
VXFORM1[
OpenTypes
OpenCust
OpenAircraft
LinkBuyToSell
LinkSellToBuy
PackFiles
TestCreateK
TestCopyc
TestDataCopy
FileStruc~
CustBuyer_KeyPress7
CustSeller_KeyPress
BuyRecs_Click
TypesOpen
BofExpr
EofExpr
vxTableDeclare
VX_RED
vxTableField
VX_FIELD
VX_EXPR
BuyerRecB
BrowseBuyers
BuyerReturn
VXFORM4
Aircraft_Clicko
AircraftDbf
vxUseDbf
AirtypesDbfO
vxUseNtx]
Aircraf2Ntx
AircraftReturn
VXFORM5
CustMemo_Click
vxMemoEdit
Form_Paint
vxFormFrame
vxCtlStyle
VX_RAISE
VX_RECESS
Picture1
BROWSE_DELETE
CustCompany_GotFocus
vxCloseNtxl
Aircust2Ntx{
Aircust3Ntx
Aircust1Ntx
vxCloseAll
FindWindow
SendMessage
WM_CLOSE
Aircraft_Click
there is only one aircraft sell record allowed-
to a customer so this makes it a little simpler
Close states file to free some handles-
also does vxTableReset-
open airtypes file and aircraft file-
\vb\vxbtest\aircraft.dbf
Error Opening aircraft.dbf. Aborting.
\vb\vxbtest\aircraf1.ntx
\vb\vxbtest\aircraf2.ntx
No aircraft records. Add?
BuyRecs_Click
open airtypes file and buyer file
Set up browse table limited to buyer records
that match the CustKey. We do this by sending
the vxTableDeclare proc a beginning ofs
file expression and an end of file expression.
b_code < '
b_code > '
The vxBrowse object now knows to limit the-
records in the table to those that have b_code
values equal to CustKey. We also scope the records with the
"6" following the EofExpr and set the quick key index tot
"7". An explanation follows:d
The key we are going to use to browse this file isd
b_code + b_cat, whose elements are 6 long and 3 long
respectively. Every record we are interested in has thet
same b_code (i.e., they all belong to the same customer).
Setting the scope index to 6 determines the action to be.
taken when the HOME or END keys are depressed. The normal
value is 0, which takes you to the first and last logical
records in the file when HOME or END is hit. If other than
zero, then the HOME key will result in a softseek on thea
file to the current key for the length specified by the
scope index. The END key will softseek to the current key
plus 1 and then skip back one record to position thet
record pointer to the last record in the group.
The quick index is set to 7, which is the first positiony
of the aircraft type code in the key. We aren't event
going to display the b_code for the buyer records. Setting
the quick index to 7 means that the common part of the key
for the group of records we are interested in (the firste
6 which form the customer code), will be prepended to the
quick keys entered at the keyboard before a seek is donee
on the file. Makes sense, huh?o
When scoping a file in this fashion, the only thing you
MUST do is position the record pointer to the first
record in the group and then pass that record number
to the vxBrowse proc (the StartRec& parameter).
b_cat
Description
b_desc
b_low
b_high
STR((b_high / b_low)*100,7,2)
Because we are interested in only a subset of the possible
records in the buyer file, we have to determine ourselves
whether there are any records in the file that match thes
group. If not, we ask the user if he wants to add a record.
vxBrowse normally does this, but the file must be empty
before it asks the question and sets the return value
accordingly.k
global var-
set for browse start rec-
No buyer records. Add?
CustAdd_Click
clear form for addition of new record
Record Addition Request
ensure data entry enabled
reset the buttons
CustAddress_GotFocus
a_address
CustAddress_KeyPress
{Tab}
CustBrowse_Click
so we don't close files
when we unload the form
CustBuyer_KeyPress
{Tab}
CustCancel_Click
Clear form data and reset button status
Operation cancelled
we must disable data entry because the user
could enter a new record in the blank boxes
and then press the Add button. The TypeAdd_Click-
routine clears the form boxes again prior tol
accepting input so the user's work would be lost-
and he would be mad.h
CustCity_GotFocus
a_city
CustCity_KeyPress
{Tab}
CustCode_GotFocus
set up text length limit-
a_code
CustCode_KeyPress
Convert customer code to uppercase as it is being entered
also convert enter key to tab
{Tab}
CustCompany_GotFocus
a_company
CustCompany_KeyPress
{Tab}
CustDataClear
Clear Form in preparation for add or after successful delete
dd-mmm-yyyy
dd-mmm-yyyy
CustDataLoad
Load data from customer record
ensure data entry enabled
extract field values-
a_code
a_name
a_company
a_address
a_city
a_state
a_zip
a_phoneres
a_phonebus
a_fax
Return from logical field interrogation
vxTrue() is -1 (TRUE) or 0 (FALSE).
By using the unary negation operator
we will transform any -1 values to the
checkbox value 1, which means "selected"
a_buyer
a_seller
vxDateFormat() routine returns a date in the-
format dd-mmm-
y, which the Visual Basic
DateValue function inderstands. We will put
the creation date into a variable so we can
perform some date arithmetic on it to determine
the number of days on filei
a_cdate
dd-mmm-yyyy
use the vxDateString function as an example of
display dates
a_rdate
set customer key for other links-
CustDelete_Click
get user confirmation of delete
Confirm Delete
we must also delete any attached buyer and-
aircraft recordse
set global CustKey for links to buyer and aircraft filese
save record number-
Close states file to free some handles-
also does vxTableReset-
delete buyer recordsv
in VXBMOD.BAS
in cust code order-
b_code
delete aircraft record
in VXBMOD.BAS
in cust code order-
reopen states fileu
in VXBMOD.BAS
now delete the requested record
Deleted
Delete failed
Delete cancelled
CustExit_Click
current form is unloaded because if needed again
the form_load proc must be invoked to reset the
control datad
CustFax_GotFocus
a_fax
CustFax_KeyPress
{Tab}
CustMemo_Click
Edit memo. Always have an ENABLED form showing to act as-
parent to the memo window. It also must have the focus.
Copy the code below EXACTLY to ensure successful memoedits.
save rec num to goto later-
make sure form has focus
a_memo
reset rec buffera
unlock the record
CustName_GotFocus
a_name
CustName_KeyPress
{Tab}
CustNext_Click
skip forward one record
if skip error, only allow exit-
Error on Skip Next. Try Reindex.
test for end of file
End of File!
Skipped to record
rec unlocked here
CustPhBus_GotFocus
a_phonebus
CustPhBus_KeyPress
{Tab}
CustPhRes_GotFocus
a_phoneres
CustPhRes_KeyPress
{Tab}
CustPrevious_Click
skip back one recorde
if skip error, only allow exit
Error on Skip Previous. Try Reindex.
test for beginning of filer
Beginning of File!
Skipped to record
CustSave_Click
Validate data when save button is pressed
verify something in the field
Field cannot be empty
verify unique key if adding
Duplicate Key on Add
verify that state code is in states file-
on code
State code not found
set vxbase logical values based on-
status of check box
if we're updating a record, save old buyer/seller
status in case we have to make adjustments to
the buyer and aircraft files if the status changes
a_buyer
a_seller
set up date strings in preparation for replace-
dd-mmm-yyyy
dd-mmm-yyyy
a_cdate
Data passed. Put it away
a_code
a_name
a_company
a_address
a_city
a_state
a_zip
a_phoneres
a_phonebus
a_fax
a_buyer
a_seller
a_cdate
a_rdate
we might have a new revision date
a_rdate
Update status box
Record
appended
Record
saved
enable/display buyer/aircraft buttons
set global CustKey for links to buyer and aircraft files
save record number-
Close states file to free some handles-
also does vxTableReset-
Test old buyer status and remove records from buyer
file if he is no longer a buyer but once wasm
in VXBMOD.BAS
in cust code order-
Confirm delete of existing buyer records
b_code
if delete denied then reset buyer status to true
a_buyer
Test old seller status and remove record from aircraft
file if he is no longer a seller but once was
in VXBMOD.BAS
in cust code order-
Confirm delete of existing aircraft record
if delete denied then reset seller status to true
a_seller
reopen states file
in VXBMOD.BAS
Update Button Status
CustSeller_KeyPress
{Tab}
CustState_GotFocus
a_state
CustState_KeyPress
{Tab}
CustStateHelp_Click
display a browse window on the state file. If the user
double clicks a state or presses ENTER on a highlighted
record, we'll get the record number back and we can
stuff the state code into CustState.text
on state name
State and Provincial Abbreviations
after a browse, always re-register the database
with the window with a vxSelectDbf before attemptingA
to access a field in the help file.
statecode
CustZip_GotFocus
a_zip
CustZip_KeyPress
{Tab}
DisableCustData
Disables data entry when the cancel button-
is presseda
EnableCustData
enables all data entry controls on the form
which are disabled by the CustCancel_Click Proc
Form_Load
On form load analyze results of browse return
Record addition request
if user pressed ENTER then file is positioned
at current record and the record number isn
returned in CustReturn. In this case we assume
he wants to edit that record.
call general proc to load controls-
can't change keyt
a_seller
a_buyer
Edit record
Form_Paint
sample code that illustrates closing of
a pick list browse window if the user
sets the focus back to this form without
closing the pick list window firsti
State and Provincial Abbreviations
normal paint procedurev
if delete request from browse, do it now
because we must let enhanced controls
paint before asking for delete confirmation
Form_Unload
close customer and state files and reset
table and restart menu window if we'ree
NOT being unloaded by BrowseCust